package mspdt.pocket.wallet;

import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class AccountAdapter extends ArrayAdapter<String> {
	private final Activity context;
	private ArrayList<String> names = new ArrayList<String>();
	private ArrayList<String> amounts = new ArrayList<String>();
	
	
	public AccountAdapter(Activity context, ArrayList<String> names, ArrayList<String> amounts) {
		super(context, R.layout.main_list);
		this.context = context;
		this.names = names;
		this.amounts = amounts;

	}
	


	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = context.getLayoutInflater();
		View rowView = inflater.inflate(R.layout.main_list, null, true);
		
		TextView tv_account = (TextView)rowView.findViewWithTag(R.id.main_list_account);
		TextView tv_amount = (TextView)rowView.findViewWithTag(R.id.main_list_amount);
		
		tv_account.setText(names.get(position));
		tv_amount.setText(amounts.get(position));
		
		return rowView;
	}
}